import { requestClient } from '#/api/request';

export namespace User {
  export interface Dept {
    searchValue: null;
    createBy: null;
    createTime: null;
    updateBy: null;
    updateTime: null;
    remark: null;
    params: string;
    deptId: number;
    parentId: null;
    ancestors: null;
    deptCode: null;
    deptName: string;
    orderNum: null;
    leader: string;
    phone: null;
    email: null;
    status: null;
    delFlag: null;
    parentName: null;
    children: any[];
  }
  export interface Row {
    searchValue: null;
    createBy: string;
    createTime: Date;
    updateBy: null;
    updateTime: null;
    remark: null | string;
    params: string;
    userId: number;
    deptId: null | number;
    userName: string;
    nickName: string;
    email: string;
    phonenumber: string;
    sex: string;
    avatar: string;
    salt: null;
    status: string;
    delFlag: string;
    loginIp: string;
    loginDate: Date | null;
    dept: Dept | null;
    roles: any[];
    roleIds: null;
    postIds: null;
    roleId: null;
    admin: boolean;
  }
  export interface GetListReturn {
    total: number;
    rows: Row[];
    code: number;
    msg: string;
  }

  export interface GetListParams {
    pageNum: number;
    pageSize: number;
    deptId?: string;
    phonenumber?: string;
    userName?: string;
  }
}

// 获取列表
export const getUserList = (params: User.GetListParams) =>
  requestClient.get<User.GetListReturn>('/system/user/list', {
    params,
  });
